package summary;

/**
 * @Author: 海琳琦
 * @Date: 2022/7/12 21:43
 * https://leetcode.cn/problems/robot-return-to-origin/
 */
public class Title657 {

    public boolean judgeCircle(String moves) {
        int dx, dy;
        dx = 0;
        dy = 0;
        for (int i = 0; i < moves.length(); i++) {
            char c = moves.charAt(i);
            if (c == 'U') {
                dx--;
            } else if (c == 'D') {
                dx++;
            } else if (c == 'L') {
                dy--;
            } else {
                dy++;
            }
        }
        return dx == 0 && dy == 0;
    }

    private void dfs(String moves) {

    }

    public static void main(String[] args) {

    }
}
